package com.example.demo.controller;

import com.example.demo.bean.Message;
import com.example.demo.sevice.MessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class MessageController {
    @Autowired
    private MessageService messageService;

    /*查询*/
    @RequestMapping("/message")
    public List<Message> message(String Hospital) {
        System.out.println(Hospital);
        return messageService.message(Hospital);
    }

    /*新增*/
    @RequestMapping("/message1")
    public void insert(Message message) {
        messageService.insert(message);
    }

    /*删除*/
    @RequestMapping("/message2")
    public void delete(String Hospital) {
        messageService.delete(Hospital);
    }

    /*修改*/
    @RequestMapping("/message3")
    public void update(Message message) {
        messageService.update(message);
    }

    @RequestMapping("/message4")
    public List<Message> sel(String Hospital){
        System.out.println(Hospital);
       return messageService.sel(Hospital);
    }
}
